-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenConceptLab/ocl_issues#22 | exclude retired concepts and/or mappings from exports #14
base: master
Are you sure you want to change the base?
OpenConceptLab/ocl_issues#22 | exclude retired concepts and/or mappings from exports #14
Conversation
core/common/tasks.py
Outdated
@@ -56,7 +56,7 @@ def export_source(self, version_id): | |||
version.add_processing(self.request.id) | |||
try: | |||
logger.info('Found source version %s. Beginning export...', version.version) | |||
write_export_file(version, 'source', 'core.sources.serializers.SourceVersionExportSerializer', logger) | |||
write_export_file(self.request, version, 'source', 'core.sources.serializers.SourceVersionExportSerializer', logger) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PatrickCmd these methods should not be dependent on the request
object.
passing include_retired=True
in export_source
directly as a parameter keeps things flexible and the same can be passed to write_export_file
. The view should control request query params.
The reason I don't like using request object in write_export_file
is it's a very low-level method and if I want to call it anywhere else I need to have a full request object, which is an overkill in my opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@snyaggarwal I have worked on this. please do review again.
11e3fa5
to
2c6ad01
Compare
@PatrickCmd The missing thing is a test to exclude retired concepts |
ea03273
to
481d93a
Compare
core/common/models.py
Outdated
@cached_property | ||
def exclude_retired_export_path(self): | ||
last_update = self.last_child_update.strftime('%Y%m%d%H%M%S') | ||
return self.generic_export_path(suffix="{}_non_retired.zip".format(last_update)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non_retired -> unretired
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
core/common/utils.py
Outdated
@@ -330,6 +336,8 @@ def write_export_file( | |||
logger.info('Done compressing. Uploading...') | |||
|
|||
s3_key = version.export_path | |||
if not include_retired: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export_path
is an expensive call, since its calculates on runtime so use it only if needed
s3_key = version.export_path if include_retired else version.exclude_retired_export_path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
@PatrickCmd This looks good. Few things that are still left:
|
481d93a
to
7a97a85
Compare
7a97a85
to
e552dc8
Compare
e552dc8
to
fd2297d
Compare
0fc07a3
to
cf7a6aa
Compare
…ow excluded from exports
cf7a6aa
to
02f9138
Compare
Retired concepts and/or mappings can now be excluded from concepts and or mappings.